Field of the Invention
The present invention generally relates to three-dimensional (3D) graphics processing and, more particularly, to handling post-z coverage data in raster operations.
Description of the Related Art
Computer generated images that include 2D and 3D graphics objects are typically rendered using a graphics processing unit (GPU) with one or more multistage graphics processing pipelines. Such graphics pipelines include various programmable and fixed function stages. Programmable stages include various processing units that execute shader programs to render graphics objects and to generate various visual effects associated with graphics objects. Fixed function stages perform additional graphics operations not performed by the programmable stages. One such fixed-function unit is a raster operations unit that performs operations such as stencil, z test, blending, and the like, and outputs pixel data as processed graphics data for storage in graphics memory. The GPU renders graphics objects into one or more render targets. Each render target includes multiple picture elements (pixels), and each pixel may, in turn, include multiple samples. Once rendering completes, the pixels in one or more render targets may be transmitted to a display device for visual display of the rendered image.
During rendering, the GPU determines coverage information for each graphics primitive, where a graphics primitive includes points, lines, and triangles in 3D space. The graphics primitives are subdivided into fragments, where each fragment corresponds to one or more samples of a particular pixel in a render target. Once the GPU determines coverage information for the fragments, the GPU may then compute color or other pixel information for the covered samples each fragment. One drawback with this approach is the GPU may waste computational effort computing color and other pixel information for fragments that are not visible in the final rendered image. Fragments associated with a particular graphics primitive may be covered by fragments associated with a different graphics primitive that is nearer to the screen surface of the display device. Computing color and other pixel information for obscured fragments reduces the time available for rendering graphics objects that are visible in the final image, thus decreasing overall GPU performance.
One possible solution to this problem is to compute color and other pixel information for fragments that pass a depth test, where the depth test determines which fragments are visible and which fragments are not visible based on distance from the screen surface. However, in some cases, such a depth test may be performed at a late stage in the graphics processing pipeline. As a result, the depth test results are unknown at the time the color and other pixel information are computed. In other cases, the unit that typically performs such depth testing may be in a low-power state to increase battery life. Therefore, the results of the depth testing may be unavailable at the time the GPU renders the fragments.
As the foregoing illustrates, what is needed in the art is a technique for rendering fragment data in a graphics processing pipeline that reduces the amount of processing performed for obscured fragments.